package cn.s1995.sloth.bizs.service.impl;

import cn.s1995.sloth.bizs.constant.CacheNames;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import cn.s1995.sloth.bizs.entity.Sku;
import cn.s1995.sloth.bizs.mapper.SkuMapper;
import cn.s1995.sloth.bizs.service.SkuService;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.cache.annotation.Caching;
import org.springframework.stereotype.Service;
/**
 * sku
 *
 * @author Lex
 * @date 2023-12-19 11:47:58
 */
@Service
public class SkuServiceImpl extends ServiceImpl<SkuMapper, Sku> implements SkuService {

    @Override
    @Caching(evict = {
            @CacheEvict(cacheNames = CacheNames.sku, key = "#skuId"),
            @CacheEvict(cacheNames = CacheNames.skuList, key = "#prodId")
    })
    public void removeSkuCacheBySkuId(Long skuId,Long prodId) {

    }

    @Override
    @Cacheable(cacheNames = CacheNames.sku, key = "#skuId")
    public Sku getSku(Long skuId) {
        return this.getById(skuId);
    }
}
